package com.fesco.mis.fm.config.cxf;

import com.fesco.mis.fm.webservice.FmServiceWS;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.xml.ws.Endpoint;
import java.util.Arrays;

/**
 * <descption>webservice配置</descption>
 * @date ：2017/9/4 14:46
 * @author：梅海波<meihaibo13186@sinosoft.com.cn>
 * @version:0.1
 */
@Configuration
public class CXFConfig {

	@Autowired
    private FmServiceWS fmServiceWS;

	@Bean(name = Bus.DEFAULT_BUS_ID)
	public SpringBus springBus() {
		return new SpringBus();
	}
	//JAX-WS发布
	@Bean
	public Endpoint WSServer() {
		EndpointImpl endpoint = new EndpointImpl(springBus(), fmServiceWS);
		endpoint.publish("/FmServiceWS");
		return endpoint;
	}
}